sum=0
# print(summmmmmmm)#NameError: name 'summmmmmmm' is not defined
def add(a,b):
    # print(sum)
    global sum
    sum=sum+1#UnboundLocalError: cannot access local variable 'sum' where it is not associated with a value
    print(sum)
    print('--------------')
    num=100#局部变量
    num=num+1
    # sub(a,b)
    #不推荐
    # def mul(a,b):
    #     return a*b
    return a+b,a*a+b*b

def sub(a,b):
    return a-b



result = add(b=20, a=10)
print(result)#(30, 500)

#斐波那契
def fib(n):
    if n<=2:
        return 1
    return fib(n-1) + fib(n-2)

print(fib(10))
for i in range(1,10+1):
    print(fib(i), end=',')


    #匿名函数
    f = lambda a,b: a+b
    f(1,2)